package com.ethan.cj.ssm.dao;

import com.ethan.cj.ssm.entity.People;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * 人员管理dao层接口
 */
@Mapper
@Repository
public interface PeopleDao {
    /**
     * 带条件查询人员分页查询
     * @param param
     * @return
     */
     List<People> pagePeopleList(Map<Object,Object> param);

    /**
     *新增人员
     * @param people
     * @return
     */
     int insertPeople(People people);
    /**
     * 安姓名查询人员
     */
    People selectPeopleByName(String pname);

    /**
     * 通过姓名查询人员不是当前id
     * @param map
     * @return
     */
    People selectPeopleName(Map<String,Object> map);
    /**
     * 通过手机号查询人员不是当前id
     * @param map
     * @return
     */
    People selectPeoplePhoneNum(Map<String,Object> map);

    /**
     * 按姓名查询人员
     */
    People selectPeopleByPhonenum(String phonenum);

    /**
     * 修改人员信息
     * @param people
     * @return
     */
    int updatePeople(People people);

    /**
     * 根据id删除人员信息
     * @param pid
     * @return
     */
    @Delete("delete from people where p_id=#{pid}")
    int deletePeppleById(int pid);

    /**
     * 查询分页总条数
     * @return
     */
    int selectCount(Map map);

    /**
     * 根据id查询
     */
    People selectPeopleByPid(int pid);

    /**
     * 根据id修改状态
     */
    int updateStatus(Map<String,Object> param);
    /**
     * 修改登录信息
     */
    int updateLogin(People people);
}
